package com.yjs.houtai.service.serviceImpl;

import com.yjs.houtai.entity.Message;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.yjs.houtai.mapper.GoodsMapper;
import com.yjs.houtai.entity.Goods;
import com.yjs.houtai.service.GoodsService;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Resource
    private GoodsMapper goodsMapper;

    @Override
    public Message deleteByPrimaryKey(Integer goodsId) {
        return goodsMapper.deleteByPrimaryKey(goodsId)==1?Message.success(null):Message.fail(null);
    }

    @Override
    public Message insert(Goods goods) {

        return null;
    }

    @Override
    public Message insertSelective(Goods goods) {
        return goodsMapper.insertSelective(goods)==1?Message.success(null).add(goodsMapper.selectByPrimaryKey(goods.getgoodsId())):Message.fail(null);
    }

    @Override
    public Message selectByPrimaryKey(Integer goodsId) {
        return goodsMapper.selectByPrimaryKey(goodsId)!=null?Message.success(null).add(goodsMapper.selectByPrimaryKey(goodsId)):Message.fail(null);
    }

    @Override
    public Message updateByPrimaryKeySelective(Goods goods) {
        return goodsMapper.updateByPrimaryKeySelective(goods)==1?Message.success(null).add(goodsMapper.selectByPrimaryKey(goods.getgoodsId())):Message.fail(null);
    }

    @Override
    public Message updateByPrimaryKey(Goods record) {
        return Message.success(null).add(goodsMapper.selectAll());
    }

    @Override
    public Message selectAll() {
        return Message.success(null).add(goodsMapper.selectAll());
    }

}

